package com.claimSettlement.controller;

import com.claimSettlement.pojo.Policyholders;
import com.claimSettlement.pojo.Recognizee;
import com.claimSettlement.service.PolicyholdersOpenFeginService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 调用客户管理微服务控制层
 * 曹文韬 05-24
 */
@RestController
@RequestMapping("/user")
public class ClientController {
    @Autowired
    private PolicyholdersOpenFeginService policyholdersOpenFeginService;

    @RequestMapping("/policyholders/getPolicyholdersAll")
    public PageInfo<Policyholders> getPolicyholdersAll(int page){
        return policyholdersOpenFeginService.getPolicyholdersAll(page);
    }

    @RequestMapping("/recognizee/getRecognizeeAll")
    public PageInfo<Recognizee> getRecognizeeAll(int page){
        return policyholdersOpenFeginService.getRecognizeeAll(page);
    }

    @RequestMapping("/policyholders/selectPolicyholdersByNameOrCredenId")
    public PageInfo<Policyholders> selectPolicyholdersByNameOrCredenId(String name,String credenId,int page){
        return policyholdersOpenFeginService.selectPolicyholdersByNameOrCredenId(name, credenId, page);
    }

    @RequestMapping("/recognizee/getRecognizeeByNameOrCredentialsId")
    public PageInfo<Recognizee> getRecognizeeByNameOrCredentialsId(String name,String credentialsId,int page){
        return policyholdersOpenFeginService.getRecognizeeByNameOrCredentialsId(name, credentialsId, page);
    }

    @RequestMapping("/policyholders/getPolicyholdersById")
    public Policyholders getPolicyholdersById(int policyholdersId){
        return policyholdersOpenFeginService.getPolicyholdersById(policyholdersId);
    }

    @RequestMapping("/recognizee/getRecognizeeById")
    public Recognizee getRecognizeeById(int recognizeeId){
        return policyholdersOpenFeginService.getRecognizeeById(recognizeeId);
    }

    @RequestMapping(value = "/policyholders/insPolicyholders", method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    public String insPolicyholders(@RequestBody Policyholders policyholders){
        return policyholdersOpenFeginService.insPolicyholders(policyholders);
    }

    @RequestMapping(value = "/policyholders/updPolicyholders", method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    public String updPolicyholders(@RequestBody Policyholders policyholders) {
        return policyholdersOpenFeginService.updPolicyholders(policyholders);
    }

    @RequestMapping(value = "/policyholders/delPolicyholders",produces = "text/html;charset=UTF-8")
    public String delPolicyholders(int policyholdersId){
        return policyholdersOpenFeginService.delPolicyholders(policyholdersId);
    }

    @RequestMapping(value = "/recognizee/insRecognizee", method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    public String insRecognizee(@RequestBody Recognizee recognizee){
        return policyholdersOpenFeginService.insRecognizee(recognizee);
    }

    @RequestMapping(value = "/recognizee/updRecognizee", method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    public String updRecognizee(@RequestBody Recognizee recognizee){
        return policyholdersOpenFeginService.updRecognizee(recognizee);
    }

    @RequestMapping(value = "/recognizee/delRecognizee",produces = "text/html;charset=UTF-8")
    public String delRecognizee(int recognizeeId){
        return policyholdersOpenFeginService.delRecognizee(recognizeeId);
    }

    @RequestMapping("/policyholders/getPolicyholdersAll2")
    public List<Policyholders> getPolicyholdersAll2(){
        return policyholdersOpenFeginService.getPolicyholdersAll2();
    }

    @RequestMapping(value = "/recognizee/getRecognizeePid")
    public List<Recognizee> getRecognizeePid(){
        return policyholdersOpenFeginService.getRecognizeePid();
    }

    /*@RequestMapping("/policyholders/getPolicyholdersNameAndId")
    List<Policyholders> getPolicyholdersNameAndId(){
        return policyholdersOpenFeginService.getPolicyholdersNameAndId();
    }*/
}
